const express = require("express");
const router = express.Router();
const userController = require("../controllers/userController");

/**
 * @route GET /api/users
 * @description 获取用户列表（支持分页和过滤）
 * @access Public
 */
router.get("/", userController.getAllUsers);

/**
 * @route GET /api/users/:id
 * @description 根据ID获取用户详情
 * @access Public
 */
router.get("/:id", userController.getUserById);

/**
 * @route POST /api/users
 * @description 创建新用户
 * @access Public
 */
router.post("/", userController.createUser);

/**
 * @route PUT /api/users/:id
 * @description 更新用户信息
 * @access Public
 */
router.put("/:id", userController.updateUser);

/**
 * @route DELETE /api/users/:id
 * @description 删除用户
 * @access Public
 */
router.delete("/:id", userController.deleteUser);

module.exports = router;
